﻿@model CmsEntityMetaFieldLinkModel
@{
    ResFile = "cms_Metas";
}
@functions{

    public SelectList GetProviders(IEnumerable<string> source)
    {
        return new SelectList(source.Select(p=>new {Text=_(p), Value=p}), "Value", "Text");
    }
}
<div class="b-form b-form_bordered b-form_theme_white">
    <div class="b-form__head b-form__head-allbordered">
        <fieldset class="b-form">
            <ol class="b-form__rows ul-reset g-clear">
                <li class="b-form__row g-clear">
                    @Html.ValidationMessageFor(m => m.MetaFieldName)
                    <label for="@Html.GetClientIdFor(m => m.MetaFieldName)">@_("Internal name")</label>
                    @Html.TextBoxFor(p => p.MetaFieldName, new { @class = "text text_long" })
                </li>
                <li class="b-form__row g-clear b-form__row_textarea">
                    <label for="@Html.GetClientIdFor(m => m.MetaFieldDescription)">@_("Description")</label>
                    @Html.TextAreaFor(p => p.MetaFieldDescription, new { @class = "text textarea" })
                </li>
                <li class="b-form__row g-clear">
                    @Html.ValidationMessageFor(m => m.MetaFieldType)
                    <label for="@Html.GetClientIdFor(m => m.MetaFieldType)">@_("System Type")</label>
                    @Html.TextBoxFor(p => p.MetaFieldType, new { @class = "text" })
                    <span style="color: #666666">@_("(Example: System.Int32, mscorlib)")</span>
                </li>
                <li class="b-form__row g-clear">
                    <label for="@Html.GetClientIdFor(m => m.IsSystem)">@_("Is Visible")</label>
                    @Html.CheckBoxFor(p => p.IsSystem, new { @class = "js-checkbox-show-hide", data_container = ".js-custom-editor-name" })
                </li>
                <li class="b-form__row g-clear js-custom-editor-name">
                    <label>@_("Input Control")</label>
                    <select id="SelectedInputControl" name="SelectedInputControl">
                        <option value="0" data-partial-view="@Model.EditorName" data-system-type="@Model.MetaFieldType">@_("Custom")</option>
                        <option value="1" data-partial-view="MediaPicker" data-system-type="System.Int32, mscorlib">@_("Media picker (basic)")</option>
                        <option value="2" data-partial-view="MediaPickerWithUpload" data-system-type="System.Int32, mscorlib">@_("Media picker with upload")</option>
                    </select>
                </li>
                <li class="b-form__row g-clear js-custom-editor-name">
                    <label for="@Html.GetClientIdFor(m => m.EditorName)">@_("Custom Control Name")</label>
                    @Html.TextBoxFor(p => p.EditorName, new { @class = "text" })
                </li>
                <li class="b-form__row g-clear">
                    <label for="@Html.GetClientIdFor(m => m.DisplayLabel)">@_("Display Label")</label>
                    @Html.TextBoxFor(p => p.DisplayLabel, new { @class = "text" })
                </li>
                <li class="b-form__row g-clear">
                    <label for="@Html.GetClientIdFor(m => m.IsRequired)">@_("Is Required")</label>
                    @Html.CheckBoxFor(p => p.IsRequired)
                </li>
                <li class="b-form__row g-clear">
                    <label for="@Html.GetClientIdFor(m => m.IsAllowMultipleValues)">@Html.Raw(_("Allowed Multiple<br /> Values"))</label>
                    @Html.CheckBoxFor(p => p.IsAllowMultipleValues)
                </li>
                <li class="b-form__row g-clear">
                    <label for="@Html.GetClientIdFor(m => m.PredefinedListOfValues)">@Html.Raw(_("Predefined list of<br /> values to select"))</label>
                    @Html.CheckBoxFor(p => p.PredefinedListOfValues, new { @class = "js-checkbox-show-hide", data_container = ".js-values-container" })
                </li>     
                <li class="b-form__row g-clear js-values-container">
                    <label for="@Html.GetClientIdFor(m => m.AddPleaseSelect)">@_("Add please select option")</label>
                    @Html.CheckBoxFor(p => p.AddPleaseSelect)
                </li>            
                <li class="b-form__row g-clear js-values-container">
                    @Html.ValidationMessageFor(m => m.MetaValuesProviderName)
                    <label for="@Html.GetClientIdFor(m => m.MetaValuesProviderName)">@_("Source of values")</label>
                    @Html.DropDownListFor(p => p.MetaValuesProviderName, GetProviders(Model.ValuesProviders), _("Please select"), new { @class = "js-values-source", data_url = Url.Action("GetAddtionalViewForm") })
                </li>
            </ol>
            <div class="js-custom-values js-values-container">
                @if (!string.IsNullOrEmpty(Model.ValuesControl))
                {
                    @Html.Partial(Model.ValuesControl)
                }
            </div>

        </fieldset>
    </div>
</div>
<div class="b-form__button">
    @Html.HiddenFor(p => p.EntityMetaFieldId)
    @Html.HiddenFor(p => p.Id)
    @Html.HiddenFor(p => p.EntityTypeParameter)
    <input class="b-button" id="btnSave" name="btnSave" type="submit" value="@_("Save")" />
</div>